package twelve.decorator.example;

import java.io.UnsupportedEncodingException;

public class StringDisplay extends Display{
    private String string;
    public StringDisplay(String s){
        this.string = s;
    }
    @Override
    public int getColumns() throws UnsupportedEncodingException {
        return string.getBytes("Shift_JIS").length;
    }

    @Override
    public int getRows() {
        return 1;
    }

    @Override
    public String getRowText(int row) {
        if(row == 0){
            return string;
        }else {
            return null;
        }
    }
}
